<?php

class Db_Tables_BjmMembersLink extends Zend_Db_Table
{
    protected $_name = 'bjm_members_link';
	var $member_id;
	
	function ProductsSent()
	{
		$result = array();
		
		if($this->member_id)
		{
			$mod_type = new Db_Tables_BjmMembersLinkType();
			$row = $mod_type->fetchRow("member_id=".intval($this->member_id)." and type_name='默认'");
			if($row)
			{
				$mtid = $row->mtid;
				
				if($mtid)
				{
					$select = $this->select();
					$select->from($this->_name, array("product_id"));
					$select->where("mtid=".intval($mtid));
					$rows = $this->fetchAll($select);
					
					if($rows)
					{
						foreach($rows as $row)
						{
							$result[] = $row["product_id"];
						}
					}
				}
			}
		}
		
		return $result;
	}
}